﻿using System;
using System.Collections.Generic;
using System.Text;
using Component;
using DevExpress;
using System.IO;
using DevExpress.Xpo;
namespace Component
{
    public class GalleryDB:Base
    {
        public static XPCollection<Gallery> GetAll()
        {
            XPCollection<Gallery> _xpGallery = new XPCollection<Gallery>(KetNoiCSDL.session);
            _xpGallery.Sorting = SetupSort(ColumGallery._Priority, true);
            return _xpGallery;
        }
        public static Component.Gallery GetObjectByid(int id, bool admin)
        {
            XPCollection<Gallery> _xpGallery = new XPCollection<Gallery>(KetNoiCSDL.session);
            _xpGallery.Filter = FilterAll(admin);
            return _xpGallery.Lookup(id);
        }
        public static bool TestExistFile(string path)
        {
            XPCollection<Gallery> _xpGallery = new XPCollection<Gallery>(KetNoiCSDL.session);
            _xpGallery.Filter = FilterByString(ColumGallery._Path, path, true);
            if (_xpGallery.Count > 0)
            {
                return true;
            }
            return false;
        }
    }
}
